package com.example.commentserver.manager;

import com.example.commentserver.entity.Comment;
import com.example.commentserver.mapper.CommentMapper;
import com.example.commentserver.params.PageCommentParams;
import com.example.commentserver.vo.CommentVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentManager {
    @Autowired
    private CommentMapper commentMapper;
    @Autowired
    private CommentCacheManager commentCacheManager;
    public void insertComment(Comment comment){
        commentMapper.insert(comment);
    }
    public void deleteComment(String id){
        commentMapper.deleteById(id);
    }

    public void updateComment(Comment comment){
        commentMapper.updateById(comment);
    }
    public List<CommentVO> listComment(PageCommentParams pageCommentParams){
        return commentMapper.listComment(pageCommentParams.getGoodsId());
    }

}
